package mapper;

import org.mybatis.spring.SqlSessionTemplate;
import org.mybatis.spring.support.SqlSessionDaoSupport;
import pojo.User;

import java.util.List;

public class UserMapperImpl extends SqlSessionDaoSupport implements UserMapper{


	//用第二种获取

	@Override
	public List<User> selectUser() {

		User user = new User(5, "小王", "3264685");

		UserMapper mapper = getSqlSession().getMapper(UserMapper.class);

		mapper.addUser(user);
		mapper.deleteUser(3);

		return mapper.selectUser();
	}

	@Override
	public int addUser(User user) {
		return getSqlSession().getMapper(UserMapper.class).addUser(user);
	}

	@Override
	public int deleteUser(int id) {
		return getSqlSession().getMapper(UserMapper.class).deleteUser(id);
	}
}
